function getRequestObject() {
  if (window.XMLHttpRequest) {
    return(new XMLHttpRequest());
  } else if (window.ActiveXObject) { 
    return(new ActiveXObject("Microsoft.XMLHTTP"));
  } else {
    return(null); 
  }
}

function sendRequestGet(url, id) {
  var request = getRequestObject();
  request.onreadystatechange =  function() { handleResponse(request, id); };
  request.open("GET", url, true);
  request.send(null);
}

function sendRequestPost(url, id, data) {
	  var request = getRequestObject();
	  request.onreadystatechange =  function() { handleResponse(request, id); };
	  request.open("POST", url, true);
	  request.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
	  request.send(data);
}

function handleResponse(request, id) {
  if ((request.readyState == 4) && (request.status == 200)) {
	 document.getElementById(id).innerHTML = request.responseText;
  }
}

function paramGet(url, id, param) {
	var prmval = "param=" + document.getElementById(param).value;
	var qstring = url + "?" + prmval;
	sendRequestGet(qstring, id);
}

function paramPost(url, id, param) {
	var data = "param=" + document.getElementById(param).value;
	sendRequestPost(url, id, data);
}

